.class Lrexsee/storage/RexseeZIP$4;
.super Lrexsee/core/browser/clazz/SyncTask$StringRunnable;
.source "RexseeZIP.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lrexsee/storage/RexseeZIP;->unZip(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lrexsee/storage/RexseeZIP;

.field private final synthetic val$encoding:Ljava/lang/String;

.field private final synthetic val$nameContains:Ljava/lang/String;

.field private final synthetic val$source:Ljava/lang/String;

.field private final synthetic val$target:Ljava/lang/String;


# direct methods
.method constructor <init>(Lrexsee/storage/RexseeZIP;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 0

    .prologue
    .line 1
    iput-object p1, p0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    iput-object p2, p0, Lrexsee/storage/RexseeZIP$4;->val$source:Ljava/lang/String;

    iput-object p3, p0, Lrexsee/storage/RexseeZIP$4;->val$nameContains:Ljava/lang/String;

    iput-object p4, p0, Lrexsee/storage/RexseeZIP$4;->val$target:Ljava/lang/String;

    iput-object p5, p0, Lrexsee/storage/RexseeZIP$4;->val$encoding:Ljava/lang/String;

    .line 297
    invoke-direct {p0}, Lrexsee/core/browser/clazz/SyncTask$StringRunnable;-><init>()V

    return-void
.end method


# virtual methods
.method public run()Ljava/lang/String;
    .locals 17

    .prologue
    .line 300
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$source:Ljava/lang/String;

    move-object v13, v0

    invoke-static {v13}, Lrexsee/core/utilities/Utilities;->prepareReadFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v12

    .line 301
    .local v12, "zipFile":Ljava/io/File;
    if-nez v12, :cond_0

    .line 302
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v13, v0

    # getter for: Lrexsee/storage/RexseeZIP;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v13}, Lrexsee/storage/RexseeZIP;->access$0(Lrexsee/storage/RexseeZIP;)Lrexsee/core/browser/Browser;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v14, v0

    invoke-virtual {v14}, Lrexsee/storage/RexseeZIP;->getInterfaceName()Ljava/lang/String;

    move-result-object v14

    const-string v15, "Error on reading ZIP file."

    invoke-virtual {v13, v14, v15}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 303
    const-string v13, "[]"

    .line 333
    :goto_0
    return-object v13

    .line 306
    :cond_0
    :try_start_0
    const-string v10, ""

    .line 307
    .local v10, "rtn":Ljava/lang/String;
    new-instance v11, Ljava/util/zip/ZipFile;

    invoke-direct {v11, v12}, Ljava/util/zip/ZipFile;-><init>(Ljava/io/File;)V

    .line 308
    .local v11, "zf":Ljava/util/zip/ZipFile;
    invoke-virtual {v11}, Ljava/util/zip/ZipFile;->entries()Ljava/util/Enumeration;

    move-result-object v4

    .local v4, "entries":Ljava/util/Enumeration;, "Ljava/util/Enumeration<*>;"
    :cond_1
    :goto_1
    invoke-interface {v4}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v13

    if-nez v13, :cond_2

    .line 330
    new-instance v13, Ljava/lang/StringBuilder;

    const-string v14, "["

    invoke-direct {v13, v14}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v13, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, "]"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v13

    goto :goto_0

    .line 309
    :cond_2
    invoke-interface {v4}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Ljava/util/zip/ZipEntry;

    .line 310
    .local v5, "entry":Ljava/util/zip/ZipEntry;
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$nameContains:Ljava/lang/String;

    move-object v13, v0

    if-eqz v13, :cond_3

    invoke-virtual {v5}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$nameContains:Ljava/lang/String;

    move-object v14, v0

    invoke-virtual {v13, v14}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v13

    if-eqz v13, :cond_1

    .line 311
    :cond_3
    invoke-virtual {v5}, Ljava/util/zip/ZipEntry;->isDirectory()Z

    move-result v13

    if-nez v13, :cond_1

    .line 312
    new-instance v13, Ljava/lang/StringBuilder;

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$target:Ljava/lang/String;

    move-object v14, v0

    invoke-static {v14}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v14

    invoke-direct {v13, v14}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    sget-object v14, Ljava/io/File;->separator:Ljava/lang/String;

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v14, v0

    invoke-virtual {v5}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v15

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$encoding:Ljava/lang/String;

    move-object/from16 v16, v0

    # invokes: Lrexsee/storage/RexseeZIP;->zip2string(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    invoke-static/range {v14 .. v16}, Lrexsee/storage/RexseeZIP;->access$3(Lrexsee/storage/RexseeZIP;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v14

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    .line 313
    .local v8, "path":Ljava/lang/String;
    invoke-static {v8}, Lrexsee/core/utilities/Utilities;->prepareWriteFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v2

    .line 314
    .local v2, "desFile":Ljava/io/File;
    if-nez v2, :cond_5

    .line 315
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v13, v0

    # getter for: Lrexsee/storage/RexseeZIP;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v13}, Lrexsee/storage/RexseeZIP;->access$0(Lrexsee/storage/RexseeZIP;)Lrexsee/core/browser/Browser;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v14, v0

    invoke-virtual {v14}, Lrexsee/storage/RexseeZIP;->getInterfaceName()Ljava/lang/String;

    move-result-object v14

    new-instance v15, Ljava/lang/StringBuilder;

    const-string v16, "Error on creating target file: "

    invoke-direct/range {v15 .. v16}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v15, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v13, v14, v15}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 316
    const-string v13, ""

    invoke-virtual {v10, v13}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v13

    if-eqz v13, :cond_4

    const-string v13, "[]"

    goto/16 :goto_0

    :cond_4
    move-object v13, v10

    goto/16 :goto_0

    .line 318
    :cond_5
    invoke-virtual {v11, v5}, Ljava/util/zip/ZipFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;

    move-result-object v6

    .line 319
    .local v6, "in":Ljava/io/InputStream;
    new-instance v7, Ljava/io/FileOutputStream;

    invoke-direct {v7, v2}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    .line 320
    .local v7, "out":Ljava/io/OutputStream;
    const/high16 v13, 0x100000

    new-array v1, v13, [B

    .line 322
    .local v1, "buffer":[B
    :goto_2
    invoke-virtual {v6, v1}, Ljava/io/InputStream;->read([B)I

    move-result v9

    .local v9, "realLength":I
    if-gtz v9, :cond_7

    .line 325
    invoke-virtual {v6}, Ljava/io/InputStream;->close()V

    .line 326
    invoke-virtual {v7}, Ljava/io/OutputStream;->close()V

    .line 327
    const-string v13, ""

    invoke-virtual {v10, v13}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v13

    if-nez v13, :cond_6

    new-instance v13, Ljava/lang/StringBuilder;

    invoke-static {v10}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v14

    invoke-direct {v13, v14}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v14, ","

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    .line 328
    :cond_6
    new-instance v13, Ljava/lang/StringBuilder;

    invoke-static {v10}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v14

    invoke-direct {v13, v14}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v14, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->val$encoding:Ljava/lang/String;

    move-object v15, v0

    # invokes: Lrexsee/storage/RexseeZIP;->entry2json(Ljava/util/zip/ZipEntry;Ljava/lang/String;)Ljava/lang/String;
    invoke-static {v14, v5, v15}, Lrexsee/storage/RexseeZIP;->access$4(Lrexsee/storage/RexseeZIP;Ljava/util/zip/ZipEntry;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v14

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    goto/16 :goto_1

    .line 323
    :cond_7
    const/4 v13, 0x0

    invoke-virtual {v7, v1, v13, v9}, Ljava/io/OutputStream;->write([BII)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    .line 331
    .end local v1    # "buffer":[B
    .end local v2    # "desFile":Ljava/io/File;
    .end local v4    # "entries":Ljava/util/Enumeration;, "Ljava/util/Enumeration<*>;"
    .end local v5    # "entry":Ljava/util/zip/ZipEntry;
    .end local v6    # "in":Ljava/io/InputStream;
    .end local v7    # "out":Ljava/io/OutputStream;
    .end local v8    # "path":Ljava/lang/String;
    .end local v9    # "realLength":I
    .end local v10    # "rtn":Ljava/lang/String;
    .end local v11    # "zf":Ljava/util/zip/ZipFile;
    :catch_0
    move-exception v13

    move-object v3, v13

    .line 332
    .local v3, "e":Ljava/lang/Exception;
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v13, v0

    # getter for: Lrexsee/storage/RexseeZIP;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v13}, Lrexsee/storage/RexseeZIP;->access$0(Lrexsee/storage/RexseeZIP;)Lrexsee/core/browser/Browser;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/storage/RexseeZIP$4;->this$0:Lrexsee/storage/RexseeZIP;

    move-object v14, v0

    invoke-virtual {v14}, Lrexsee/storage/RexseeZIP;->getInterfaceName()Ljava/lang/String;

    move-result-object v14

    invoke-virtual {v13, v14, v3}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 333
    const-string v13, "[]"

    goto/16 :goto_0
.end method
